package Kuaishou;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.apache.commons.collections.CollectionUtils;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

/**
 * @author leiwenkang <leiwenkang@kuaishou.com>
 * Created on 2021-04-19
 */
public class Test34 {
    public static void main(String[] args) {
        Map<Integer, List<Integer>> actualIdMap = Maps.newHashMap();
        actualIdMap.put(1, Lists.newArrayList(111));
        actualIdMap.put(2, Lists.newArrayList(222));
        List<Integer> allActualIds = Lists.newArrayList();
        List<Integer> orientationList = Lists.newArrayList(1, 2);
        List<Student> students = orientationList.stream().map(orientation -> {
            List<Integer> actualIds = actualIdMap.get(orientation);
            if (CollectionUtils.isNotEmpty(actualIds)) {
                allActualIds.addAll(actualIds);
            }
            return new Student(orientation);
        }).filter(orientation -> orientation.getId() != 0)
                .collect(Collectors.toList());

        System.out.println(allActualIds);
    }
}
